/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package snippet.lab6;

import java.util.ArrayList;
import java.util.Scanner;

/**
 *
 * @author hoang.pt
 */
public class ComputerList {

    ArrayList computerList;


    /**
     * @author hoang.pt
     */
    void printCollection() {

        //loop

        //System.out.println(computerList.get(0));
    }


    /**
     * @author hoang.pt
     */
    void addCollection() {

        //init
        Scanner input = new Scanner(System.in);

        //print line to add to collection
        System.out.println("Enter computer information.");
        System.out.println("id: ");
        int id = input.nextInt();

        System.out.println("name: ");
        String name = input.next();

        System.out.println("brand: ");
        String brand = input.next();

        System.out.println("price: ");
        Double price = new Double(input.nextDouble());

        //use scanner to add computer
        Computer computer = new Computer(id, name, brand, price);
        computerList = new ArrayList();

        //add to array list
        computerList.add(computer);

        //get
        System.out.println(computerList.get(0));
    }
}
